using FileServer.Abstractions;
using FileServer.Abstractions.Models;
using FileServer.Storage.MySql;
using Microsoft.Extensions.DependencyInjection;

namespace Aurora.TaskScheduler.Storage.MySql;

public class MySqlFileServerOptionExtension : IFileServerOptionsExtension
{
    private readonly Action<MySqlOptions> _configure;

    public MySqlFileServerOptionExtension(Action<MySqlOptions> configure)
    {
        _configure = configure;
    }

    public void AddServices(IServiceCollection services)
    {
        services.AddSingleton<MySqlSugarContext>();
        services.AddScoped<IFileStorage, MysqlFileStorage>();
        services.Configure(_configure);
    }
}